// pages/awaitPay/awaitPay.js
const app = getApp();
import request from "../../utils/request";
Page({

  /**
   * 页面的初始数据
   */
  data: {
    cardId:'',
    dataList:''
  },
  goback() {
    wx.navigateBack({
      delta: 1,
      price:'',
      payorderid:''
    });
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    this.setData({
      cardId:options.cardId,
      price:(options.price) * 100,
      payorderid:options.payOrderId
    })
    this.getMessage()
  },
  async getMessage(){
    const res = await request({
      url: app.globalData.baseURL + `/app-api/package/trade-order/detail?cartNo=${this.data.cardId}`,
      method:'GET'
    })
    if(res.code === 0){
      this.setData({
        dataList: res.data
      })
    }
  },
  async gopay(){
    wx.navigateTo({
      url: `/pages/paymethod/paymethod?price=${this.data.price}&payOrderId=${this.data.payorderid}`,
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function (options) {
    return {
      title: "嘉之勤官网小程序",
      path: "/pages/index/index",
      imageUrl:
        "https://youyougo2.oss-cn-chengdu.aliyuncs.com/0201506f6fc0f4145e34159c2e2ac66b94b96450dd29e5a19d177edc5dad8023.png",
    };
  },
})